<!DOCTYPE html>
<html lang="en">

<head>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>后台 管理</title>

  <!-- Custom fonts for this template-->
  <link href="/static/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">

  <!-- Custom styles for this template-->
  <link href="/static/css/sb-admin.css" rel="stylesheet">
  <link href="/static/layui/css/layui.css" rel="stylesheet">

</head>

<body class="bg-dark">

  <div class="container">
    <div class="card card-login mx-auto mt-5">
      <div class="card-header">欢迎使用</div>
      <div class="card-body">
        <form action="/api/admin/login" method="post" id="login">
          <div class="form-group">
            <div class="form-label-group">
              <input type="name" id="inputEmail" name="admin_name" class="form-control required" placeholder="管理员" required="required" autofocus="autofocus">
              <label for="inputEmail">管理员</label>
            </div>
          </div>
          <div class="form-group">
            <div class="form-label-group">
              <input type="password" id="inputPassword" name="admin_password" class="form-control required" placeholder="密码" required="required">
              <label for="inputPassword">密码</label>
            </div>
          </div>
          <div class="form-group">
            <div class="checkbox">
              <label>
                <input type="checkbox" name="is_remember" value="1">
                Remember Password
              </label>
            </div>
          </div>
          <a class="btn btn-primary btn-block" href="javascript:goSubmit();">登  录</a>
        </form>
        <div class="text-center">
        </div>
      </div>
    </div>
  </div>

  <!-- Bootstrap core JavaScript-->
  <script src="/static/vendor/jquery/jquery.min.js"></script>
  <script src="/static/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Core plugin JavaScript-->
  <script src="/static/vendor/jquery-easing/jquery.easing.min.js"></script>
  <script src="/static/jquery-validation/lib/jquery.form.js"></script>
  <script src="/static/layui/layui.all.js"></script>
  <script src="/static/js/admin/common.js"></script>

  <script>
      $(function() {
          goSubmit = function(){
              var userName = $('#inputEmail').val();
              if( userName == '' || userName == null){
                  $('#inputEmail').focus();
                  return false;
              }
              var inputPassword = $('#inputPassword').val();
              if( inputPassword == '' || inputPassword == null){
                  $('#inputPassword').focus();
                  return false;
              }
              $("#login").ajaxSubmit(function (data) {
                  if(data.code != 200 ){
                      layer.msg(data.msg);
                      return false;
                  }
                  goTo('/admin/index');
              });
          }
      });
  </script>


</body>

</html>
